﻿using Client.Framework.Message;
using Client.Model;
using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Message.Request
{
    class AddEditMenuReq : RequestBaseMessage
    {
        public AddEditMenuReq(int msgId) : base(msgId)
        {

        }

        public ViewMenu Menu { get; set; }

        public override byte[] Serialize()
        {
            AddEditMenu msg = new AddEditMenu();
            if (Menu != null)
            {
                Menu menu = new Menu
                {
                    Id = Menu.ID,
                    ParentId = Menu.ParentId,
                    MenuName = Menu.MenuName ?? string.Empty,
                    Icon = Menu.Icon ?? string.Empty,
                    ScreenCode = Menu.ScreenCode ?? string.Empty,
                    MenuType = Menu.MenuType,
                    Status = (int)Menu.Status,
                    Sort = Menu.Sort,
                };
                msg.Menu = menu;
            }
            return msg.ToByteArray();
        }
    }
}
